<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>范例</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="tokyo-tyrant.constants.html">预定义常量</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.tokyotyrant.html">TokyoTyrant</a></div>
 <div class="up"><a href="book.tokyo-tyrant.html">tokyo_tyrant</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="tokyo-tyrant.examples" class="chapter">
 <h1>范例</h1>

 <p class="para">
  Basic usage
 </p>
 <div class="example" id="example-2136">
  <p><strong>Example #1 Putting and getting a key-value pair</strong></p>
  <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$tt&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">TokyoTyrant</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$tt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">put</span><span style="color: #007700">(</span><span style="color: #DD0000">"key"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"value"</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$tt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">"key"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
  </div>

  <div class="example-contents"><p>以上例程会输出：</p></div>
  <div class="example-contents screen">
<div class="cdata"><pre>
value
</pre></div>
  </div>
 </div>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="tokyo-tyrant.constants.html">预定义常量</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="class.tokyotyrant.html">TokyoTyrant</a></div>
 <div class="up"><a href="book.tokyo-tyrant.html">tokyo_tyrant</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
